/*
 * Copyright Thoughtworks, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.thoughtworks.go.apiv1.i18n;

import java.util.HashMap;
import java.util.Map;

/**
 * 存储所有页面的翻译数据
 */
public class I18nData {
    private Map<String, String> zhCN = new HashMap<>();
    private Map<String, String> en = new HashMap<>();

    public I18nData() {
    }

    public I18nData(Map<String, String> zhCN, Map<String, String> en) {
        this.zhCN = zhCN != null ? new HashMap<>(zhCN) : new HashMap<>();
        this.en = en != null ? new HashMap<>(en) : new HashMap<>();
    }

    /**
     * 合并其他翻译数据
     */
    public void merge(I18nData other) {
        if (other != null) {
            if (other.zhCN != null) {
                this.zhCN.putAll(other.zhCN);
            }
            if (other.en != null) {
                this.en.putAll(other.en);
            }
        }
    }

    public Map<String, String> getZhCN() {
        return zhCN;
    }

    public void setZhCN(Map<String, String> zhCN) {
        this.zhCN = zhCN;
    }

    public Map<String, String> getEn() {
        return en;
    }

    public void setEn(Map<String, String> en) {
        this.en = en;
    }

    @Override
    public String toString() {
        return "I18nData{" +
                "zhCN=" + zhCN +
                ", en=" + en +
                '}';
    }
}
